package chapter03;

import java.util.Scanner;

/**
 * 利用数组随机抽取观众
 * Created by a on 2017/6/9.
 */
public class Test044 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入观众的名字，以空格作分隔符");
        String str = scanner.nextLine();
        String[] personnelArray = str.split(" ");
            int index = (int) Math.random()*(personnelArray.length);
            String info = personnelArray[index];
            System.out.println("本次抽奖观众人员:\n\t"+str+"\n恭喜"+info+"成为本次观众抽奖的大奖得主."+"\n我们将为其颁发:过期牛奶二十箱");
    }

}
